<template>
  <div>
    <el-form ref="refForm" :model="formData" :rules="formSystemRules">
      <el-form-item
        label="选择体系"
        prop="evaluation_system_id"
      >
        <el-select v-model="formData.evaluation_system_id" style="width: 100%" placeholder="请选择选择体系" @change="onChang">
          <el-option
            v-for="item in system_list"
            :key="item.id"
            :label="item.name"
            :value="item.id"
          />
        </el-select>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { get } from '@/api/request'
// import { mapGetters } from 'vuex'
// import { $tooltips, $dialogs } from '@/sun-components/SunMsg.js'
export default {
  name: 'ProcessCommonEvaluationSystem',
  components: { },
  props: {
    model: {
      type: Object,
      default: function() {
        return {}
      }
    },
    show: {
      type: Boolean,
      default: false
    },
    systemTag: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {
      system_list: [],
      formSystemRules: {
        evaluation_system_id: [
          { required: true, message: '请选择体系', trigger: 'change' }
        ]
      }
    }
  },
  computed: {
    show_system() {
      return this.show
    },
    formData() {
      return this.model
    }
  },
  watch: {
    show_system: {
      handler: function(show) {
        console.log('2023-03-08 15:08:13 --- 打印', show)
        if (show) {
          this.requestData()
        }
      }
    }
  },
  created() {
    if (this.show) this.requestData()
  },
  methods: {
    async requestData() {
      await get(`evaluation/system`, { 'filter[evaluation_system_tag]': this.systemTag, 'filter[status]': 1 }).then(response => {
        if (response.code === 0) {
          this.$set(this, 'system_list', response.data)
          console.log('2023-03-08 15:07:35 --- 打印', response.datas)
          // this.system_list = response.data
        }
      })
    },
    async onChang(e) {
      console.log('2023-03-08 11:53:32 --- 打印', e)
    }
  }
}
</script>
<style lang="scss" scoped>
  @import '@/styles/sun-style.scss';
  @import '@/styles/information.scss';
  .el-dialog__wrapper {
    background: rgba(0,0,0,0.3) !important;
  }
  .show-upload-demo ::v-deep {
    ul{
      display: none !important;
    }
  }
</style>
